<?php
/* 
 * 个人工作日志 计划事件管理
 */
class TodoAction extends CommonAction {
    public function _filter(&$map) {
        $key = trim($_REQUEST['keywords']);
        //TODO
        if(!empty($key)) {
            $where['content'] = array('like',"%".$key."%");
            $where['subject'] = array('like',"%".$key."%");
            $where['address'] = array('like',"%".$key."%");
            $where['_logic'] = "or";
            $map['_complex'] = $where;
        }
        $map['user_id'] = $_SESSION[C('USER_AUTH_KEY')];
        

    }

     public function _before_add(){
        $this ->assign('todoStatus',C('todostatus'));
    }

    public function _before_edit(){
        $this ->assign('todoStatus',C('todostatus'));
    }

    public function _before_index(){
        $this ->assign('count_todo',M('Todo')->where('alert_time !=0 and user_id='.$_SESSION[C('USER_AUTH_KEY')])->count(id));
    }
    
}
?>
